﻿using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Text;

namespace Web.Blog.Services.Menus
{
    public class MenuChildren
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public string Path { get; set; }
        private readonly List<MenuChildren> _childrens;
        public IReadOnlyList<MenuChildren> Childrens => _childrens.ToImmutableList();

        public MenuChildren(int id, string title, string path)
        {
            this.Id = id;
            this.Title = title;
            this.Path = path;
            _childrens = new List<MenuChildren>();
        }
        public MenuChildren CreateChildren(int id, string title, string path)
        {
            MenuChildren menu = new MenuChildren(id, title, path);
            _childrens.Add(menu);
            return menu;
        }
    }
}
